import { TOKEN_KEY,USER_INFO } from "@/constants";
import { getLocalStorage, setLocalStorage } from "./index";

/**
 * 清除token
 */
export function removeToken() {
  localStorage.removeItem(TOKEN_KEY);
}
/**
 * 设置token
 */
export function setToken(token: string) {
  setLocalStorage(TOKEN_KEY, token);
}
/**
 * 获取token
 */
export function getToken() {
  return getLocalStorage(TOKEN_KEY);
}
/**
 * 设置用户信息
 */
export function setUerInfo(info:any){
  return setLocalStorage(USER_INFO,info)
}
interface UserInfo{
  userName:string,
  account:string,
  role:string,

}
/**
 * 获取用户信息
 */
export function getUerInfo():UserInfo{
  return getLocalStorage(USER_INFO)
}